#from ucb import trace
#下了但没反应啊怎么回事
#@trace

#不过也可以自己写一个这样的函数
def trace1(fn):
    def traced(x):
        print('Calling',fn,'on argument',x)
        return fn(x)
    return traced


@trace1
def square(x):
    return x*x

@trace1
def sum_square_up_to(n):
    k=1
    total=0
    while k<=n :
        total,k =total+square(k),k+1
    return total
    